 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>JavaScript SOAP Client - DEMOS | GURU4.net</title>
        <style type="text/css">
            div.h {
                display: none;
            }
            
            div.s {
                display: block;
                margin: 10px;
            }
        </style>
        <script type="text/javascript" src="soapclient.js">
        </script>
        <script type="text/javascript">
            
 //           var url = "http://localhost:8080/logistics-ws/services/BasicManageService";
            
          var url = "/logistics-ws/services/BasicManageService";
            
            
            // DEMO 8
            function GetUsers(){
                var pl = new SOAPClientParameters();
                SOAPClient.invoke(url, "getAllPlacevo", pl, true, GetUsers_callBack);
            }
            
            function GetUsers_callBack(ul, soapResponse){
                for(i in ul){
				alert("ul."+i+":"+ul[i]);	
				}
				ul=ul.out;
				var rs="";
				alert(ul.length + " user(s) found:");
        		for(var i = 0; i < ul.length; i++)		
        			rs=rs+
        				"User No. " + (i + 1) + "\r\n" +
        				"ID: " + ul[i].placeName + "\r\n\r\n";
        				
        	    alert(rs);
                document.getElementById("repxml").innerText = soapResponse.xml;
				document.getElementById("result").innerText = rs;
                
            }
            
            
            
            // DEMO 11
            function GetSoapResponse(){
                var pl = new SOAPClientParameters();
                SOAPClient.invoke(url, "HelloWorld", pl, true, GetSoapResponse_callBack);
            }
            
            function GetSoapResponse_callBack(r, soapResponse){
                alert(soapResponse.xml);
            }
            
            // utils
            function toggle(id){
                var d = document.getElementById(id);
                if (d != null) 
                    d.className = (d.className == "h") ? "s" : "h";
            }
            
        </script>
    </head>
    <body>
        <form id="frmDemo" name="frmDemo" action="" method="post">
            <div>
                <a name="d8"></a>
                <h2>DEMO 8: arrays</h2>
                <p>
                    Using custom entity arrays. The web method returns an array with 4 
                    <kbd>
                        User
                    </kbd>
                    objects (see demo No. 7)
                </p>
                <input type="button" value="Get users" onclick="GetUsers();"/>
            </div>
			<div id='result'>
            </div>
			<hr>
			
            <div id='repxml'>
            </div>
        </form>
    </body>
</html>
